package jbox2dprocessing.compontent;

import org.jbox2d.common.Vec2;

import pbox2d.PBox2D;
import shared.BVZConstants;

public class PhysCircle extends BaseCircle {
	
	public float defaultDensity = 1.0f;
	
	public PhysCircle(PBox2D _box2d, int _master) {
		super(_box2d, _master, 1.0f);
	}

	public PhysCircle(PBox2D _box2d, int _master, float baseDensity) {
		super(_box2d, _master, baseDensity);
	}

	public PhysCircle(float baseX, float baseY, float baseRadius, PBox2D _box2d, int _master) {
		super(baseX, baseY, baseRadius, _box2d, _master, 1.0f, 0.3f, 0.4f);
	}

	public PhysCircle(float baseX, float baseY, float baseRadius,
			PBox2D _box2d, int _master, float baseDensity, float baseFriction,
			float baseRestitution) {
		super(baseX, baseY, baseRadius, _box2d, _master, baseDensity, baseFriction,
				baseRestitution);
		switch (_master) {
			case BVZConstants.BIRDSSHOOTER:
				this.baseColor = parent.color(239, 89, 49);
				break;
			case BVZConstants.ZOMBIESDEFENDER:
				this.baseColor = parent.color(19, 75, 115);
				break;
			default:
				break;
		}
	}

	public PhysCircle(float baseX, float baseY, float baseRadius,
			PBox2D _box2d, int _master, int baseColor, int baseStrokeColor,
			int baseStrokeWeight, float baseDensity, float baseFriction,
			float baseRestitution) {
		super(baseX, baseY, baseRadius, _box2d, _master, baseColor, baseStrokeColor,
				baseStrokeWeight, baseDensity, baseFriction, baseRestitution);
	}
	
	
//	Remove the body when it is out of screen
	public boolean outOfScreen(){
		Vec2 pos = box2d.getScreenPos(baseBody);
		if(pos.y > parent.height + baseRadius * baseRadius){
			killBody();
			return true;
		}
		return false;
	}
	
	public void killBody(){
		box2d.destroyBody(baseBody);
	}
}
